#! /usr/bin/env python

from infix import Infix

sqr = Infix(lambda x, y: x ** y)
e = '2 <<sqr>> 3 |sqr| (2 <<sqr>> 1) |sqr| (sqr(9000, 0) + 1)'
print('e = %s' % e, str(eval(e)))


import operator
div = Infix(operator.div)
e = '8 <<div>> (2 <<sqr>> 2)'
print('e = %s' % e, str(eval(e)))


isa = Infix(lambda x, y: x.__class__ == y.__class__)
e = '(([1,2,3] <<isa>> []), ([1,2] |isa| {}))'
print('e = %s' % e, str(eval(e)))